import java.util.HashSet;
import java.util.Objects;

public class demo6 {
    public static void main(String[] args) {
        String s = "0100110001010001";
        HashSet<Object> set = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            for (int j = i; j < s.length(); j++) {
                String x = s.substring(i,j+1);
                set.add(x);
            }

        }
        System.out.println(set.size());
    }
}
